package com.leal.client;

import java.util.HashSet;
import java.util.List;
import java.util.Objects;

/**
 * @Classname bigdata
 * @Description es mapping infos
 * @Date 2023/8/15 16:17
 * @Created by leal
 */
public class ESMapping {
    // 字段名称
    private String fieldName;
    // 字段类型
    private String fieldType;
    // 是否分词
    private final Boolean isParticiple;
    // 复合字段
    private HashSet<ESMapping> complexField;

    public ESMapping(String fieldName, String fieldType, Boolean isParticiple) {
        this.fieldName = fieldName;
        this.fieldType = fieldType;
        this.isParticiple = isParticiple;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public Boolean getParticiple() {
        return isParticiple;
    }


    public HashSet<ESMapping> getComplexField() {
        return complexField;
    }

    public void setComplexField(HashSet<ESMapping> complexField) {
        this.complexField = complexField;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ESMapping esMapping = (ESMapping) o;
        return Objects.equals(fieldName, esMapping.fieldName);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(fieldName);
    }

    @Override
    public String toString() {
        return "ESMapping{" +
                "fieldName='" + fieldName + '\'' +
                ", fieldType='" + fieldType + '\'' +
                ", isParticiple=" + isParticiple +
                ", complexField=" + complexField +
                '}';
    }
}
